package com.mde.util;

public class Validator {
	
	public static final String dbUsername = "root";
	
	public static final String dbUserpass = "12345";
	
	public static final String dbURL = "jdbc:mysql://localhost:3306/"
			+ "map_routing_db?useUnicode=true&characterEncoding=UTF-8";
	
	public static boolean validatePointData(String lat, String lon, 
			String type, String name) {
		if (lat.trim().equals("") || lon.trim().equals("") ||
			type.trim().equals("") || lat.trim().equals(""))
			return false;
		try {
			Double.parseDouble(lat);
			Double.parseDouble(lon);
			return true;
		}
		catch (NumberFormatException e) {
			return false;
		}	
	}
	
	public static boolean validateStartAndFinish(String lat1, String lon1, String lat2, String lon2) {
		if (lat1.trim().equals("") || lat2.trim().equals("") || 
			lon1.trim().equals("") || lon2.trim().equals(""))
			return false;
			
		try {
			Double.parseDouble(lat1);
			Double.parseDouble(lat2);
			Double.parseDouble(lon1);
			Double.parseDouble(lon1);
			return true;
		} catch (NumberFormatException e) {
			return false;
		}		
	}

}
